//
//  CommentController.m
//  LvXi_newVersion
//
//  Created by 王敏 on 16/9/4.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "CommentController.h"

#import "CommentView.h"

#import "CommentSuccessViewController.h"

@interface CommentController ()

@property(nonatomic,strong)CommentView * commentView;

@property(nonatomic,strong)UIButton * submitCommentButton;
@end

@implementation CommentController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = HexColor(@"#EEEEEE");
    [self.view addSubview:self.commentView];
    
    self.submitCommentButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth-2*globalMargin, Comment_height(38))];
    self.submitCommentButton.backgroundColor = HexColor(@"#3CB034");
    self.submitCommentButton.titleLabel.font = [UIFont systemFontOfSize:15];
    [self.submitCommentButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.submitCommentButton setTitle:@"提交评价" forState:UIControlStateNormal];
    [self.submitCommentButton addRadius:5];
    self.submitCommentButton.x = globalMargin;
    self.submitCommentButton.y = ScreenHeight - self.submitCommentButton.height - Comment_height(60);
    [self.view addSubview:self.submitCommentButton];
    [self.submitCommentButton addTarget:self action:@selector(submitCommentButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setUpNavi];
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
}

-(void)setUpNavi{
    [super setUpNavi];
    self.navigationItem.title = @"评价晒单";
}


-(CommentView*)commentView{
    if(_commentView == nil){
        _commentView = [[CommentView alloc] initWithFrame:CGRectMake(globalMargin, globalMargin+64, ScreenWidth-2*globalMargin, ScreenWidth-2*globalMargin)];
    }
    return _commentView;
}

-(void)backButtonClick:(UIButton*)button{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)submitCommentButtonClick:(UIButton*)button{
    CommentController * vc = [[CommentSuccessViewController alloc] iniWithCommentSuccessViewControllerStyle:CommentSuccessViewControllerStyleComSuccess];
    [self.navigationController pushViewController:vc animated:YES];
}

@end
